package com.yl.web.controller.api;

import com.yl.common.annotation.Anonymous;
import com.yl.common.core.domain.AjaxResult;
import com.yl.common.utils.StringUtils;
import com.yl.domain.HiHumanDTO;
import com.yl.domain.StudentReplyDO;
import com.yl.domain.dto.LoginDTO;
import com.yl.service.ZhiXingService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("/zhixing")
@RestController
@Anonymous
public class ZhiXingController {
    private static final Logger log = LoggerFactory.getLogger(ZhiXingController.class);

    @Resource
    ZhiXingService zhiXingService;

    @RequestMapping("/getTiKuTagList")
    @ResponseBody
    public AjaxResult getTiKuTagList() {
        log.info("获取题库标签列表==========");
        return zhiXingService.getTiKuTagList();
    }

    @RequestMapping("/createHiHuman")
    @ResponseBody
    public AjaxResult createHiHuman(@RequestBody HiHumanDTO hiHumanDTO) {
        log.info("生成数字人视频==========hiHumanDTO={}", hiHumanDTO);
        if (StringUtils.isBlank(hiHumanDTO.getContent())) {
            return AjaxResult.error("内容为空");
        }
        return zhiXingService.createHiHuman(hiHumanDTO.getContent());
    }

    @RequestMapping("/getHiHuman")
    @ResponseBody
    public AjaxResult getHiHuman(@RequestBody HiHumanDTO hiHumanDTO) {
        log.info("获取数字人视频地址==========hiHumanDTO={}", hiHumanDTO);
        if (hiHumanDTO.getId() == null) {
            return AjaxResult.error("Id为空");
        }
        return zhiXingService.getHiHuman(hiHumanDTO.getId());
    }

    @RequestMapping("/getStudentPage")
    @ResponseBody
    public AjaxResult getStudentPage(@RequestBody HiHumanDTO hiHumanDTO) {
        log.info("获取学生列表==========hiHumanDTO={}", hiHumanDTO);
        return zhiXingService.getStudentPage(1, 10);
    }


    @RequestMapping("/verifyAccount")
    @ResponseBody
    public AjaxResult verfifyAccount(@RequestBody LoginDTO loginDTO) {
        log.info("验证职行账号接口==========loginDTO={}", loginDTO);
        return zhiXingService.verifyAccount(loginDTO.getAccount(),loginDTO.getPassword(),loginDTO.getType());
    }

    /**
     * 获取报告
     * @author : y
     * @date :  2024/7/12 22:39
     **/

    // @RequestMapping("/getReport")
    // @ResponseBody
    // public AjaxResult getReport(@RequestBody StudentReplyDO studentReplyDO) {
    //     log.info("获取报告==========studentReplyDO={}", studentReplyDO);
    //     studentReplyDO.get
    //     return zhiXingService.getReport()
    // }



}
